package com.gitee.hermer.engine.jars.dependent.activemq.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

import com.gitee.hermer.boot.jee.commons.reflect.ClassUtils;
import com.gitee.hermer.boot.jee.commons.utils.PropertiesUtils;
import com.gitee.hermer.boot.jee.commons.utils.StringUtils;
import com.gitee.hermer.boot.jee.commons.verify.Assert;
import com.gitee.hermer.engine.jars.core.domain.EngineConstant;
import com.gitee.hermer.engine.jars.dependent.dsm.domain.EngineProperties;

@PropertySource(EngineConstant.ENGINE_CONFIG_PROPERTIES_CLASS_PATH)
public class ActiveMQProperties extends EngineProperties {


	@Value(EngineConstant.PROPERTIES_KEY_ENGINE_CONFIG_ACTIVEMQ_BROKERS)
	private String brokerURL;
	@Value(EngineConstant.PROPERTIES_KEY_ENGINE_CONFIG_ACTIVEMQ_MONITOR_INTERVAL)
	private Integer monitorIntervalTime;
	@Value(EngineConstant.PROPERTIES_KEY_ENGINE_CONFIG_ACTIVEMQ_IS_USE_ASYNC_SEND)
	private Boolean isUseAsyncSend;
	@Value(EngineConstant.PROPERTIES_KEY_ENGINE_CONFIG_ACTIVEMQ_IS_USE_TRANSACTED)
	private Boolean isUseTransacted;
	@Value(EngineConstant.PROPERTIES_KEY_ENGINE_CONFIG_ACTIVEMQ_GET_SESSION_TIMEOUT)
	private Integer createSessionOutTime=1000;
	@Value(EngineConstant.PROPERTIES_KEY_ENGINE_CONFIG_ACTIVEMQ_POOL_MAXIDLE)
	private Integer maxIdle=100;
	@Value(EngineConstant.PROPERTIES_KEY_ENGINE_CONFIG_ACTIVEMQ_POOL_MINIDLE)
	private Integer minIdle=100;
	@Value(EngineConstant.PROPERTIES_KEY_ENGINE_CONFIG_ACTIVEMQ_POOL_MAXTOTEL)
	private Integer maxTotal=100;
	
	
	public String[] getBrokers(){
		Assert.hasText(getBrokerURL());
		return StringUtils.split(getBrokerURL(), EngineConstant.STR_COMMA);
	}
	
	
	
	public String getBrokerURL() {
		return brokerURL;
	}
	public void setBrokerURL(String brokerURL) {
		this.brokerURL = brokerURL;
	}
	public Integer getMonitorIntervalTime() {
		return monitorIntervalTime;
	}
	public void setMonitorIntervalTime(Integer monitorIntervalTime) {
		this.monitorIntervalTime = monitorIntervalTime;
	}
	public Boolean getIsUseAsyncSend() {
		return isUseAsyncSend;
	}
	public void setIsUseAsyncSend(Boolean isUseAsyncSend) {
		this.isUseAsyncSend = isUseAsyncSend;
	}
	public Boolean getIsUseTransacted() {
		return isUseTransacted;
	}
	public void setIsUseTransacted(Boolean isUseTransacted) {
		this.isUseTransacted = isUseTransacted;
	}
	public Integer getCreateSessionOutTime() {
		return createSessionOutTime;
	}
	public void setCreateSessionOutTime(Integer createSessionOutTime) {
		this.createSessionOutTime = createSessionOutTime;
	}
	public Integer getMaxIdle() {
		return maxIdle;
	}
	public void setMaxIdle(Integer maxIdle) {
		this.maxIdle = maxIdle;
	}
	public Integer getMinIdle() {
		return minIdle;
	}
	public void setMinIdle(Integer minIdle) {
		this.minIdle = minIdle;
	}
	public Integer getMaxTotal() {
		return maxTotal;
	}
	public void setMaxTotal(Integer maxTotal) {
		this.maxTotal = maxTotal;
	}
	

}
